
PN_CHARS_BASE		[A-Za-z]
PN_CHARS_U			[A-Za-z_]
PN_CHARS				[A-Za-z0-9_-]
PN_PREFIX				{PN_CHARS_BASE}([A-Za-z0-9_\.-]*[A-Za-z0-9_-])?
PN_LOCAL				({PN_CHARS_U}|[0-9])(({PN_CHARS} | \.)*{PN_CHARS})?
PNAME_NS		 		{PN_PREFIX}?:
PNAME_LN				{PNAME_NS}{PN_LOCAL}


%{
	#include <stdio.h>
	#include "y.tab.h"
	#include "../model/datatypes.h"
	#include "../model/model.h"

	#define YYSTYPE Expression
	extern YYSTYPE yylval;

	void yyerror(char *);
%}

%%

\n												{ ++yylineno; }
													/* skip whitespace */
[ \t]											;
													/* skip comments */
"//".*\n									;
													/* parantheses, equal sign */
[()=]											{ return *yytext; }

													/* Ontology */
Prefix										{ return PREFIX; }
Ontology 									{ return ONTOLOGY; }
Import										{ return IMPORT; }


													/* Declaration */
													/* skip */
Declaration.*							;	


													/* Entity */
Class											{ return CLASS; }
ObjectProperty						{ return OBJECT_PROPERTY; }

EntityAnnotation.*				; 
													/* Annotation assertion */
AnnotationAssertion.*			;
													/* Annotation */
Annotation.*							;



													/* Class Expression */
ObjectIntersectionOf			{ return OBJECT_INTERSECTION_OF; }
ObjectSomeValuesFrom			{ return OBJECT_SOME_VALUES_FROM; }


													/* Class Axiom */
SubClassOf								{ return SUB_CLASS_OF; }
EquivalentClasses					{ return EQUIVALENT_CLASSES; }


													/* Object Property Axiom */
SubObjectPropertyOf				{ return SUB_OBJECT_PROPERTY_OF; }
TransitiveObjectProperty	{ return TRANSITIVE_OBJECT_PROPERTY; }


"<"[^<>"{}|\^`\\ ]*">"		{ return IRI_REF; }
{PNAME_NS}								{ return PNAME_NS; }

%%

int yywrap(void) {
	return 1;
}
